﻿using System;
using System.Management;

namespace MissingLinq.Linq2Management
{
	/// <summary>
	/// Represents connection parameters used when accessing WMI objects
	/// </summary>
	public class ConnectionInfo
	{
		/// <summary>
		/// Initializes a new <see cref="ConnectionInfo"/>
		/// </summary>
		public ConnectionInfo() : this(null, null) { }

		/// <summary>
		/// Initializes a new <see cref="ConnectionInfo"/>
		/// </summary>
		/// <param name="machineName">The machine name, or null if the local machine name should be used</param>
		public ConnectionInfo(String machineName) : this(machineName, null) { }

		/// <summary>
		/// Initializes a new <see cref="ConnectionInfo"/>
		/// </summary>
		/// <param name="connectionOptions">Management connection options, or null if not specified</param>
		public ConnectionInfo(ConnectionOptions connectionOptions) : this(null, connectionOptions) { }

		/// <summary>
		/// Initializes a new <see cref="ConnectionInfo"/>
		/// </summary>
		/// <param name="machineName">The machine name, or null if the local machine name should be used</param>
		/// <param name="connectionOptions">Management connection options, or null if not specified</param>
		public ConnectionInfo(String machineName, ConnectionOptions connectionOptions)
		{
			MachineName = machineName ?? Environment.MachineName;
			Options = connectionOptions;
		}

		/// <summary>
		/// The WMI server machine name
		/// </summary>
		public String MachineName { get; private set; }

		/// <summary>
		/// Management connection options, or null if not specified
		/// </summary>
		public ConnectionOptions Options { get; private set; }
	}
}
